package kotlincore.chapt02

class Book(var name:String) {  //用var声明的参数name引用可被改变
    fun printName(){
        println(this.name)
    }

}

fun main() {
    val book = Book("Thinking in Java") //用val声明的book对象的引用不可变
    book.name = "Diving into Kotlin"
    book.printName() //Diving into Kotlin
}